import React, { Component } from 'react'
import propTypes from 'prop-types'
import Item from '../Item/Item'
export default class List extends Component {
    static propTypes = {
        todos: propTypes.array.isRequired,
        updateTodo:propTypes.func.isRequired
    }
    render() {
        const { todos, updateTodo,deleteTodo } = this.props
        // 对传入的props进行：类型必要性的限制
        return (
            <div>
                {
                    todos.map(v => <Item key={v.id} {...v} updateTodo={updateTodo} deleteTodo={deleteTodo} />)
                }
            </div>
        )
    }
}
